13. SQLite Database Object and Inserting Data
SQLite Database Object and Inserting Data
INSTRUCTOR NOTE:
Here’s the statement I added to the onCreate() method of the CatalogActivity class. No need for you to modify the CatalogActivity class yet. You’ll do that in the next quiz.
ContentValues values = new ContentValues();
values.put(PetEntry.COLUMN_PET_NAME, "Garfield");
values.put(PetEntry.COLUMN_PET_BREED, "Tabby");
values.put(PetEntry.COLUMN_PET_GENDER, PetEntry.GENDER_MALE);
values.put(PetEntry.COLUMN_PET_WEIGHT, 7);
db.insert(PetEntry.TABLE_NAME, null, values);